//
//  UIButton+Extension.swift
//  MicroBlogFunc
//
//  Created by GK on 16/4/14.
//  Copyright © 2016年 GK. All rights reserved.
//

import UIKit

extension UIButton{
    
    convenience init(imgStr:String ,bgImgStr: String = "timeline_card_bottom_background",title:String , fontSize: CGFloat = 12 )
    {
        self.init(frame: CGRectZero)
        
        // 按钮就创建完成了
        // 设置按钮背景图片
        setBackgroundImage(UIImage(named: bgImgStr), forState: UIControlState.Normal)
        setBackgroundImage(UIImage(named: "\(bgImgStr)_highlighted"), forState: UIControlState.Highlighted)
        
        // 设置按钮图片
        setImage(UIImage(named: imgStr), forState: UIControlState.Normal)
        
        // 设置按钮标题
        setTitle(title, forState: UIControlState.Normal)
        
        // 设置文字大小和颜色
        setTitleColor(UIColor.lightGrayColor(), forState: UIControlState.Normal)
        titleLabel?.font = UIFont.systemFontOfSize(fontSize)
        
        
        
        
        
    }
    
    
}

















